"use strict";
const common_vendor = require("../../common/vendor.js");
const common_api = require("../../common/api.js");
const common_url = require("../../common/url.js");
require("../../common/request.js");
const _sfc_main = {
  data() {
    return {
      consultantDetail: {},
      consultId: "",
      systemInfo: {},
      backIcon: common_url.Icons.Back,
      manIcon: common_url.Icons.Man,
      womanIcon: common_url.Icons.Woman,
      accountIcon: common_url.Icons.Account,
      fileIcon: common_url.Icons.File,
      chatIcon: common_url.Icons.Chat,
      meritIcon: common_url.Icons.Merit,
      line2text: {
        age: "年龄",
        helpCount: "帮人数",
        averageRank: "用户好评率"
      },
      bodyText: {
        info: "个人介绍",
        rank: "职称：",
        field: "擅长领域",
        comment: "用户评价纪录",
        chatButton: "立即开始咨询"
      },
      comments: {},
      commentNum: 0
    };
  },
  onLoad(e) {
    this.systemInfo = common_vendor.index.getSystemInfoSync();
    this.systemInfo.titleBarHeight = (common_vendor.index.getMenuButtonBoundingClientRect().top - this.systemInfo.statusBarHeight) * 2 + common_vendor.index.getMenuButtonBoundingClientRect().height;
    this.consultId = e.id;
    this.getConsultantDetail();
  },
  methods: {
    getConsultantDetail() {
      common_vendor.index.showLoading({ title: "加载中" });
      common_api.getConsultant_id(this.consultId).then((res) => {
        console.log(res);
        this.consultantDetail = res.data;
        common_api.getConsultantComment_id(this.consultId, {
          page: 1,
          pageSize: 1
        }).then((commentRes) => {
          console.log(commentRes.data);
          this.commentNum = commentRes.data.pageNum;
          this.comments = commentRes.data.comments;
          common_vendor.index.hideLoading();
        });
      });
    },
    backEvent() {
      common_vendor.index.navigateBack();
    },
    toChat() {
      common_vendor.index.navigateTo({
        url: "/pages/heart-profile/heart-profile?id=" + this.consultId
      });
    }
  }
};
if (!Array) {
  const _easycom_uni_rate2 = common_vendor.resolveComponent("uni-rate");
  _easycom_uni_rate2();
}
const _easycom_uni_rate = () => "../../uni_modules/uni-rate/components/uni-rate/uni-rate.js";
if (!Math) {
  _easycom_uni_rate();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  return common_vendor.e({
    a: Object.keys($data.consultantDetail).length && Object.keys($data.comments).length
  }, Object.keys($data.consultantDetail).length && Object.keys($data.comments).length ? common_vendor.e({
    b: common_vendor.s("background-image: url(" + $data.consultantDetail.avatar + ");"),
    c: common_vendor.t($data.backIcon),
    d: common_vendor.o((...args) => $options.backEvent && $options.backEvent(...args)),
    e: common_vendor.s("top:" + $data.systemInfo.statusBarHeight + "px;height:" + $data.systemInfo.titleBarHeight + "px;"),
    f: $data.consultantDetail.avatar,
    g: common_vendor.t($data.consultantDetail.name),
    h: common_vendor.t($data.consultantDetail.gender ? $data.manIcon : $data.womanIcon),
    i: common_vendor.t($data.consultantDetail.state ? "忙碌中" : "空闲中"),
    j: common_vendor.n($data.consultantDetail.state ? "mang-state" : "kong-state"),
    k: common_vendor.t($data.consultantDetail.age),
    l: common_vendor.t($data.line2text.age),
    m: common_vendor.t($data.consultantDetail.helpCount),
    n: common_vendor.t($data.line2text.helpCount),
    o: common_vendor.t(Math.round($data.consultantDetail.averageRank)),
    p: common_vendor.t($data.line2text.averageRank),
    q: common_vendor.s("top: " + ($data.systemInfo.statusBarHeight + $data.systemInfo.titleBarHeight) + "px;"),
    r: common_vendor.t($data.accountIcon),
    s: common_vendor.t($data.bodyText.info),
    t: common_vendor.t($data.bodyText.rank),
    v: common_vendor.t($data.consultantDetail.title),
    w: common_vendor.t($data.consultantDetail.detailIntro),
    x: common_vendor.t($data.fileIcon),
    y: common_vendor.t($data.bodyText.field),
    z: common_vendor.f($data.consultantDetail.expertiseTag, (itemtag, index, i0) => {
      return {
        a: common_vendor.t(itemtag.expertiseName),
        b: index
      };
    }),
    A: common_vendor.t($data.meritIcon),
    B: common_vendor.t($data.bodyText.comment + "（" + $data.commentNum + "条）"),
    C: $data.commentNum
  }, $data.commentNum ? {
    D: $data.comments[0].userAvatar,
    E: common_vendor.t($data.comments[0].userName),
    F: common_vendor.p({
      readonly: true,
      value: $data.comments[0].visitorScore
    }),
    G: common_vendor.t($data.comments[0].visitorComment)
  } : {}, {
    H: common_vendor.t($data.chatIcon),
    I: common_vendor.t($data.bodyText.chatButton),
    J: common_vendor.o((...args) => $options.toChat && $options.toChat(...args))
  }) : {});
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "D:/Project/heart-3.0/heart-field-3.0/pages/consultant-detail/consultant-detail.vue"]]);
wx.createPage(MiniProgramPage);
